#ifndef __CLIENTPROTOCOLACTION_H__
#define __CLIENTPROTOCOLACTION_H__

#include "common/chat.h"
#include <QList>

enum ActionType {
	TConnection = 1,
	TChat = 2,
	TUser = 3,
	TFriend = 4,
};

enum ConnectionFunction {
	CFDeny = 5,
	CFAccept = 6,
};

enum ChatFunction {
	HFStart = 1,
	HFSend = 3,
	HFExit = 4,
	HFTerminate = 5,
	HFEnter = 6,
};

enum UserFunction {
	UFFriendStatus = 1,
	UFFriendList = 2,
	UFPassword = 3,
};

enum FriendFunction {
	FFInvite = 1,
	FFDeny = 3,
	FFAdd = 4,
	FFRemove = 5,
};

class ClientProtocolAction {
public:
	virtual ActionType getType() = 0;
};

class ClientConnectionAction: public ClientProtocolAction {
public:
	ClientConnectionAction(ConnectionFunction function, Friend* f = 0);
	ActionType getType();
	ConnectionFunction getFunction();
	Friend* getFriend();
private:
	ConnectionFunction function;
	Friend* f;
};

class ClientChatAction: public ClientProtocolAction {
public:
	ClientChatAction(ChatFunction function, Chat* chat, QString message = "");
	ClientChatAction(ChatFunction function, Chat* chat, Friend* f, QString message = "");
	ActionType getType();
	ChatFunction getFunction();
	Chat* getChat();
	QString getMessage();
	Friend* getFriend();
private:
	ChatFunction function;
	Chat* chat;
	Friend* f;
	QString message;
};

class ClientUserAction: public ClientProtocolAction {
public:
	ClientUserAction(UserFunction function, Friend* f);
	ClientUserAction(UserFunction function, QList<Friend*> friends);
	ClientUserAction(UserFunction function, bool isPasswordOk);
	ActionType getType();
	UserFunction getFunction();
	Friend* getFriend();
	QList<Friend*> getFriends();
	bool getPasswordOk();
private:
	UserFunction function;
	Friend* f;
	QList<Friend*> friends;
	bool isPasswordOk;
};

class ClientFriendAction: public ClientProtocolAction {
public:
	ClientFriendAction(FriendFunction function, QString login);
	ClientFriendAction(FriendFunction function, Friend* f);
	ActionType getType();
	FriendFunction getFunction();
	QString getLogin();
	Friend* getFriend();
private:
	FriendFunction function;
	QString login;
	Friend* f;
};

#endif

